#!/bin/bash
#
#make TYPE=TSN_SIM 表示对tsn仿真应用场景进行编译
#make TYPE=TSN_FPGA 表示对tsn FPGA应用场景进行编译

CC = gcc -g
AR = ar

LDHDPATH =-lm -I ./complib/libsim/include -I ./complib/libtsmp/include 
LDLIBS =  -I ./complib/cjson/ -L ./complib/cjson -lcjson

LDLIBS1  = -L ./complib/libsim/ -lsim
LDLIBS2  = -L ./complib/libtsmp/ -ltsmp 


LIBTSMPSRC=./complib/libtsmp/src/


TSMPAPI = ./complib/libtsmp/

CTR_INIT = ./multicast_ctr_init/
INIT_CFG = ./register_init_cfg/
TIMER_FUNC = ./timer_func/
IGMP_PKT_PROCESS = ./igmp_pkt_process/



multicast: main.c multicast_ctr_init.o register_init.o timer_func.o igmp_pkt_process.o
	$(CC) -o multicast main.c $(CTR_INIT)multicast_ctr_init.o $(INIT_CFG)register_init.o $(TIMER_FUNC)timer_func.o $(IGMP_PKT_PROCESS)igmp_pkt_process.o $(LDLIBS) $(TSMPAPI)libtsmp.a $(LDHDPATH) $(LDLIBS1) $(LDLIBS2)


multicast_ctr_init.o:
	$(CC) -o $(CTR_INIT)multicast_ctr_init.o -c $(CTR_INIT)multicast_ctr_init.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)

register_init.o:
	$(CC) -o $(INIT_CFG)register_init.o -c $(INIT_CFG)register_init.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)
	
timer_func.o:
	$(CC) -o $(TIMER_FUNC)timer_func.o -c $(TIMER_FUNC)timer_func.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)

igmp_pkt_process.o:
	$(CC) -o $(IGMP_PKT_PROCESS)igmp_pkt_process.o -c $(IGMP_PKT_PROCESS)igmp_pkt_process.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)

clean:
	rm -rf multicast  $(CTR_INIT)*.o $(INIT_CFG)*.o $(TIMER_FUNC)*.o $(IGMP_PKT_PROCESS)*.o 



